from rest_framework import serializers
from apps.testapp.models import TestModel


class TestSerialzier(serializers.ModelSerializer):
    """
        {
            'sku':商品名称
            'sku_id':商品id
        }
    """

    # 返回TestModel模型类中的str方法的结果
    sku = serializers.StringRelatedField(read_only=True)
    sku_id = serializers.IntegerField()

    class Meta:
        model = TestModel
        fields = "__all__"
